<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
    <script src="vue.js"></script>
</head>
<body>
      <div id="app">
        <p id ="num">{{a}}</p>
        <button id="add" @click="add">增加</button>
        <button id="dec" @click="dec">减少</button>
    </div>
    <script>
        Vue.createApp({
            data(){
                return{
                    a:0
                }
            },
            methods: {
                add(){
                    this.a++
                },
                dec(){
                    this.a--
                }
            },
        }).mount("#app")
    </script>
     </script>
</body>
</html>